#!/usr/bin/env bash

RDIR=$(dirname $(readlink -f "$0"))

INSROOT="${RDIR}/installroot"
CFG="${RDIR}/Dockerfile"
REGNAME="${REGNAME:-colorfulrune}"
IMGNAME="opencloudos"
IMGTAG=${IMGTAG:-8.6}

{
  mkdir -pv "$INSROOT"
  sudo dnf --installroot "$INSROOT" -y install dnf
  sudo podman build --squash-all -f "$CFG" -t "${REGNAME}/${IMGNAME}:${IMGTAG}" "$RDIR"
}
